<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang="">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="1.本地创建仓库： 首先进行初始化1.在桌面创建mkdir 仓库名2.进入这个仓库cd make（在这里假设这个仓库名为make）3.首先我们要初始化这个仓库，输入：git init 这是我们可以在make里看到一个.git的文件4.现在我们创建一个html文件touch from.html（运行git status -sb查看文件状态，现在的mmm.html前面有？？问号）5.然后我们先要把这个">
<meta property="og:type" content="article">
<meta property="og:title" content="Git+GitHub的使用">
<meta property="og:url" content="http://yoursite.com/2018/03/20/五-Git-GitHub的使用/index.html">
<meta property="og:site_name" content="From&#39;s blog">
<meta property="og:description" content="1.本地创建仓库： 首先进行初始化1.在桌面创建mkdir 仓库名2.进入这个仓库cd make（在这里假设这个仓库名为make）3.首先我们要初始化这个仓库，输入：git init 这是我们可以在make里看到一个.git的文件4.现在我们创建一个html文件touch from.html（运行git status -sb查看文件状态，现在的mmm.html前面有？？问号）5.然后我们先要把这个">
<meta property="og:locale" content="default">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-c10d1686a0c533a0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-04628131fe9d66a8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/640">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-fc1fef603a4eba97.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-60a48248d118f921.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-585fd7e9f3b225aa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:image" content="https://upload-images.jianshu.io/upload_images/11007474-a567bbde6837bb53.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">
<meta property="og:updated_time" content="2018-03-31T13:21:18.745Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Git+GitHub的使用">
<meta name="twitter:description" content="1.本地创建仓库： 首先进行初始化1.在桌面创建mkdir 仓库名2.进入这个仓库cd make（在这里假设这个仓库名为make）3.首先我们要初始化这个仓库，输入：git init 这是我们可以在make里看到一个.git的文件4.现在我们创建一个html文件touch from.html（运行git status -sb查看文件状态，现在的mmm.html前面有？？问号）5.然后我们先要把这个">
<meta name="twitter:image" content="https://upload-images.jianshu.io/upload_images/11007474-c10d1686a0c533a0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2018/03/20/五-Git-GitHub的使用/"/>





  <title>Git+GitHub的使用 | From's blog</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">From's blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            Archives
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2018/03/20/五-Git-GitHub的使用/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Wang hang">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="From's blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Git+GitHub的使用</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2018-03-20T22:19:13+08:00">
                2018-03-20
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="1-本地创建仓库："><a href="#1-本地创建仓库：" class="headerlink" title="1.本地创建仓库："></a>1.本地创建仓库：</h1><ul>
<li><strong>首先进行初始化</strong><br>1.在桌面创建<code>mkdir 仓库名</code><br>2.进入这个仓库<code>cd make</code>（在这里假设这个仓库名为make）<br>3.首先我们要初始化这个仓库，输入：<code>git init</code> 这是我们可以在make里看到一个.git的文件<br>4.现在我们创建一个html文件<code>touch from.html</code>（运行<code>git status -sb</code>查看文件状态，现在的mmm.html前面有？？问号）<br>5.然后我们先要把这个文件<code>git add mmm.html</code>添加到暂存区（现在我们再<code>git status -sb</code>查看一下文件状态，此时前面应该是 A，也就是我要把这些文件添加到仓库里去）<br>6.接下来我们<code>git commit -m &quot;文件信息&quot;</code>（将这个文件正式的提交至本地仓库）<br>7.你使用 <code>git log</code> 就可以看到历史上的变动<br>完成以上步骤，本地的仓库就创建完成了。</li>
</ul>
<h1 id="2-将本地仓库上传至GitHub"><a href="#2-将本地仓库上传至GitHub" class="headerlink" title="2.将本地仓库上传至GitHub"></a>2.将本地仓库上传至GitHub</h1><ul>
<li>在GitHub上创建一个空仓库<br><img src="https://upload-images.jianshu.io/upload_images/11007474-c10d1686a0c533a0.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt="image.png"><br><strong><em>除了名字其他一律不填</em></strong></li>
<li>然后在Git中之前创建的仓库中运行如图画圈的两行命令（建议选择SSH地址）<br><img src="https://upload-images.jianshu.io/upload_images/11007474-04628131fe9d66a8.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/640" alt="image.png"><br>然后刷新当前页面，你的仓库就上传到 GitHub 了！神不神奇？激不激动？</li>
</ul>
<h1 id="3-下载-GitHub-上的仓库到本地（刚开始建库在GitHub，然后下载，觉得这个好用）"><a href="#3-下载-GitHub-上的仓库到本地（刚开始建库在GitHub，然后下载，觉得这个好用）" class="headerlink" title="3. 下载 GitHub 上的仓库到本地（刚开始建库在GitHub，然后下载，觉得这个好用）"></a>3. <strong>下载 GitHub 上的仓库到本地</strong>（刚开始建库在GitHub，然后下载，觉得这个好用）</h1><ul>
<li>创建及下载步骤<br><img src="https://upload-images.jianshu.io/upload_images/11007474-fc1fef603a4eba97.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt="image.png"><br>然后在这里获得下载链接（最好选择SSH下载地址）<br><img src="https://upload-images.jianshu.io/upload_images/11007474-60a48248d118f921.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt="image.png"></li>
</ul>
<p>1.git clone <a href="mailto:git@github.com" target="_blank" rel="noopener">git@github.com</a>:xxxx，下载仓库<br>2.git init，初始化本地仓库 .git<br>3.git status -sb，显示当前所有文件的状态<br>4.git add 文件路径，用来将变动加到暂存区<br>5.git commit -m “信息”，用来正式提交变动，提交至 .git 仓库<br>如果有新的变动，我们只需要依次执行 git add xxx 和 git commit -m ‘xxx’ 两个命令即可。<br><strong>先 add 再 commit，行了，你学会 git 了。</strong><br>6.git log 查看变更历史。</p>
<ul>
<li><strong>如何上传更新</strong><br>你在本地目录有任何变动，只需按照以下顺序就能上传：<br><code>git add</code>文件路径<br><code>git commit -m &quot;信息&quot;</code><br><code>git pull</code> （记得加上这个哦）<br><code>git push</code><br>下面是例子<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">cd git-demo-1</span><br><span class="line">touch index2.html</span><br><span class="line">git add index2.html</span><br><span class="line">git commit -m &quot;新建 index2.html&quot;</span><br><span class="line">git pull</span><br><span class="line">git push</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>最好学会在VSCode里push，很方便！<br><br></p>
<h1 id="最后在这里交大家怎么删除GitHub上创建的库"><a href="#最后在这里交大家怎么删除GitHub上创建的库" class="headerlink" title="最后在这里交大家怎么删除GitHub上创建的库"></a>最后在这里交大家怎么删除GitHub上创建的库</h1><p>1.首先点击你在GitHub里创建的仓库，点击settings<br><img src="https://upload-images.jianshu.io/upload_images/11007474-585fd7e9f3b225aa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt="image.png"><br>2.点进去后，直接拉到最下方会看到一个 Delete this repository 点击它<br><img src="https://upload-images.jianshu.io/upload_images/11007474-a567bbde6837bb53.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600" alt="image.png"><br>3.在弹出的文本框里输入你的仓库名字，就可以删除了 So easy！  </p>
<p><br><br><em>待续</em></p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/03/20/四-命令行基础/" rel="next" title="命令行基础">
                <i class="fa fa-chevron-left"></i> 命令行基础
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/03/20/六-计算机如何存储数据及编码的进化/" rel="prev" title="计算机如何存储数据及编码的进化">
                计算机如何存储数据及编码的进化 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">Wang hang</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">52</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            

            
              
              
              <div class="site-state-item site-state-tags">
                
                  <span class="site-state-item-count">2</span>
                  <span class="site-state-item-name">tags</span>
                
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#1-本地创建仓库："><span class="nav-number">1.</span> <span class="nav-text">1.本地创建仓库：</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-将本地仓库上传至GitHub"><span class="nav-number">2.</span> <span class="nav-text">2.将本地仓库上传至GitHub</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-下载-GitHub-上的仓库到本地（刚开始建库在GitHub，然后下载，觉得这个好用）"><span class="nav-number">3.</span> <span class="nav-text">3. 下载 GitHub 上的仓库到本地（刚开始建库在GitHub，然后下载，觉得这个好用）</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#最后在这里交大家怎么删除GitHub上创建的库"><span class="nav-number">4.</span> <span class="nav-text">最后在这里交大家怎么删除GitHub上创建的库</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Wang hang</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
